class Person {
  def name, age

  def speak(){
    println "${this.name} speaking"
  }

  static def now(){
    new Date().format("yyyy-MM-dd HH:mm:ss")
  }

  void setAge(age){
    if (age < 0)
      throw new IllegalArgumentException("age must be a positive number")
    else
      this.age = age
  }
}

def person = new Person(name:"John Doe", age:35)

println person.age

person.age = 36

println person.age

